package com.sanhe.rfmuscle.fragment;

import static com.menu.app.util.FunctionCode.START1;
import static com.menu.app.util.FunctionCode.START2;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.menu.app.fragment.BaseFragment;
import com.menu.app.util.Utils;
import com.menu.app.util.port.SerialManage;

import org.greenrobot.eventbus.EventBus;

public class BaseWorkFragment extends BaseFragment {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().unregister(this);
        }
    }

    protected void sendTouchEvent(byte data_H, byte data_L) {
        byte[] tmp = {START1, START2, 6, -125, 16, 1, 1, 0, data_L};
        SerialManage.getInstance().send(tmp);
    }
}
